/*
 * Copyright (c) 2010 Curtis Boyden.  All rights reserved. 
 * This software was developed by Curtis Boyden and is provided under the terms 
 * of the GNU Lesser General Public License, Version 2.1. You may not use 
 * this file except in compliance with the license. If you need a copy of the license, 
 * please go to http://www.gnu.org/licenses/lgpl-2.1.txt. The Original Code is ejMud
 * (Ewerp Java MUD).  The Initial Developer is Curtis Boyden.
 *
 * Software distributed under the GNU Lesser Public License is distributed on an "AS IS" 
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
 * the license for the specific language governing your rights and limitations.
*/

package com.ewerp.mud.locations.exits;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.ewerp.mud.characters.ICharacter;
import com.ewerp.mud.core.exceptions.EwerpMudException;
import com.ewerp.mud.entities.IEntity;
import com.ewerp.mud.entities.IObjectId;
import com.ewerp.mud.entitycore.descriptions.IDescription;
import com.ewerp.mud.entitycore.descriptions.meta.IDescriptionMeta;
import com.ewerp.mud.locations.rooms.IRoom;

public class BaseExit implements IExit {
    protected IObjectId id;

    protected Map<Class<? extends IDescriptionMeta>, IDescription> descriptions = new HashMap<Class<? extends IDescriptionMeta>, IDescription>();
    protected List<IRoom> destinations = new LinkedList<IRoom>();
    protected List<IRoom> origins = new LinkedList<IRoom>();
    
    @Override
    public List<IRoom> getDestinations() {
        return destinations;
    }

    @Override
    public IObjectId getId() {
        return id;
    }
    
    @Override
    public void setId(IObjectId exitId) {
        this.id = exitId;
    }

    @Override
    public List<IRoom> getOrigins() {
        return origins;
    }

    @Override
    public IDescription getDescription(Class<? extends IDescriptionMeta> type) {
        return descriptions.get(type);
    }

    @Override
    public void setDescription(IDescription description) {
        descriptions.put(description.getMeta().getClass(), description);
    }

    @Override
    public void use(IEntity entity) throws EwerpMudException {
        if(entity instanceof ICharacter) {
            
        }
    }

}
